package com.ctshk.rpc.payment.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * @BelongsProject: ctshk-cloud
 * @BelongsPackage: com.ctshk.rpc.payment.enums
 * @Author: hef
 * @CreateTime: 2021-04-21 14:05
 * @Description: 支付订单状态
 */
@Getter
@AllArgsConstructor
public enum PayOrderStatus {
    UNPAID(1, "未支付"),
    FULFIL(2, "已支付"),
    PAYMENT_ERROR(3, "支付失败/取消"),
    REFUNDED(4,"已退款"),
    ;
    private Integer status;
    private String name;

    public static PayOrderStatus getByStatus(Integer status) {
        PayOrderStatus payOrderStatus = Arrays.stream(PayOrderStatus.values()).filter(
                enums -> enums.getStatus().equals(status)
        ).findFirst().orElse(null);
        return payOrderStatus;
    }
}
